function getCommanderName()
{
	var strCommanderName ='';
	
	return  strCommanderName;
}

function parseCommanderName(strCommanderName)	//	Get Max Distance, Max Level of camp
{
	var arrTroopInfo = new Array();
	
	return arrTroopInfo;
}

function getAttackingCampList()
{
	var arrAttackingCampList = new Array();
	
	return arrAttackingCampList;
}

function checkEmptyCamp(arrCampCoordinates)
{
	var boolEmptyCamp = true;
	
	return boolEmptyCamp;
}

function getFreeCamp(intLevel)	//	Get free camp by level
{
	var arrCampCoordinates = new Array();

	return arrCampCoordinates;
}

function doAttack(x,y)	// launch attack (x,y)
{
	
}

function doConfirm()	// auto submit confirmation
{
	if (isXacNhanXuatBinh())
	{
	    var a = document.body.select("img");
	    if (a.length > 0)
	    {
	        document.body.select("input[name='captchacon:ccaptcha']")[0].value = getString(a[0]);
	    }
	}
	return false;
}

function doChangeCity()
{
	
}
Event.observe(window, "load", function ()
{
	if (isXacNhanXuatBinh())
	{

	}
	
	if ((isNgoaiThanh())||(isChienBao()))
	{
		window.open(getXuatBinhURL(),"main");
	}
	
	if (isBinhTruong())
	{
		var strCommanderName = getCommanderName();
		var arrAttackInfo = parseCommanderName(strCommanderName);
		if (arrAttackInfo.length != 0)
		{
			doChangeCity();
		}
		var intMaxDistance = arrAttackInfo[0];
		var intMaxLevel	= arrAttackInfo[1];
		
		var arrCampCoordinates = getFreeCamp(intMaxLevel);
		doAttack(arrCampCoordinates[0],arrCampCoordinates[1]);
	}
})